import vue from '@vitejs/plugin-vue'
import path from 'node:path'
import { defineConfig, loadEnv } from 'vite'

const env = loadEnv('production', '.')

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  build: {
    minify: false
  },
  server: {
    port: 3333,
    proxy: {
      '/eolink': {
        target: env.VITE_EOLINK_API_URL,
        changeOrigin: true,
        rewrite: path => path.replace(/^\/eolink/, '')
      }
    }
  }
})
